home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
.net 2002 March
/
DotNetMagazine-Issue107-Coverdisc-NET107-02-03-PCMac.bin
/
pc
/
PC Software
/
free_browsing
/
DavesQckSearchDbar3-14
/
dqsd.exe
/
searches
/
alarm.xml
< prev
next >
Wrap
Text File
|
2002-08-30
|
2KB
|
84 lines
<search function="alarm">
<name>Alarm</name>
<description>
Schedule an alarm to go off at a certain time. The alarm message is optional. (All times are in Military (24hr) Time. Supports only a single alarm.)<br/>
<div class="helpboxDescLabels">Usage:</div>
<table class="helpboxDescTable">
<tr><td>Set Alarm</td><td> - </td><td>alarm <<i>time</i>> [<<i>message</i>>]</td></tr>
<tr><td>Cancel Alarm</td><td> - </td><td>alarm cancel</td></tr>
</table>
<div class="helpboxDescLabels">Example:</div>
<table class="helpboxDescTable">
<tr><td>alarm 14:00 Staff Meeting</td></tr>
</table>
</description>
<category>Functions</category>
<contributor>Monty Scroggins</contributor>
<script><![CDATA[
var alarmTime;
var curTime;
var alarmMsg;
var alNum;
var parsedLine;
var parsedMsg;
function alarm(t)
{
if( nullArgs("alarm",t) )
return false;
if( t.match(/^cancel *$/i) )
{
clearInterval(alNum);
document.deff.q.value="Alarm Canceled..";
setTimeout("document.deff.q.value='';",1000);
}
else if( parsedLine = t.match(/(\d\d\:\d\d)\s*(.*)/) )
{
if( parsedLine[1] != null && parsedLine[1].length != 0)
alarmTime = parsedLine[1];
parsedMsg = parsedLine[2];
alarmMsg = 'Alarm: ' + alarmTime + '\n\nAlarm has Expired';
if(parsedMsg != null && parsedMsg.length != 0 )
alarmMsg = 'Alarm: ' + alarmTime + '\n\n' + parsedMsg;
alarmOn();
document.deff.q.value="Alarm Set..";
setTimeout("document.deff.q.value='';",1000);
}
else
{
window.alert("Bad Timestamp Entered. Should be HH:MM in Military Time");
return;
}
}
function IfZero( num )
{
return (num <= 9) ? ("0" + num) : num;
}
function alarmOn()
{
var dt = new Date();
curTime = IfZero(dt.getHours()) + ":" + IfZero(dt.getMinutes());
if( alarmTime == curTime )
{
clearInterval(alNum);
window.alert(alarmMsg);
}
else
alNum=setTimeout("alarmOn()", 6000)
}
]]></script>
<copyright>
Copyright (c) 2002 David Bau
Distributed under the terms of the
GNU Public License, Version 2 (http://www.gnu.org/copyleft/gpl.txt)
</copyright>
</search>